package com.ftg.learn.chapter8.dictionary;

/**
 * 中英词曲
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/7/27 上午9:20
 */
public class ZhEnDic implements DicInterface{

    //组合 : 在一个类里面可以拿到另外一个类的实例
    DicParent dp = new DicParent();

    @Override
    public String findWord(String key) {
        for (int es = 0; es < dp.getEs().length; es++) {
            if(dp.getEs()[es].getZh().equals(key)){
                return dp.getEs()[es].getEn();
            }
        }
        return "对不起";
    }

    public static void main(String[] args) {
        ZhEnDic ze = new ZhEnDic();
        System.out.println(ze.findWord("中国"));
        DicInterface a1 = new ZhEnDic();
        DicInterface a2 = new ZhKeo();
    }

}
